evaluate right side first, then remember the result as the value on the left side
in case of fractions always round down


this applies to regular attacks, power attacks, criticals and L1 techs


1) p.atk = (buffed) attack power


2) if strong regular attack (not applicable to Lv1 tech)
	p.atk = (p.atk + AGL) * (150 + STR) / 128 + 4 + (STR+1)/2 + equip bonus
		equip bonus:
			Moon Ring: level x1.25 + 10


3) damage = p.atk - defense


4) if critical hit (not applicable to Lv1 tech)
	4.a) damage = damage * (crit factor + weapon bonus + gear bonus) + crit bonus + (weapon bonus+1)/2
		crit factor:
			0 LUCK: 115%
			10 LUCK: 122%
			15 LUCK: 127%
			20 LUCK: 133%
			25 LUCK: 140%
			28 LUCK: 144%
			30 LUCK: 146%
			33 LUCK: 150%
		if critical hit against party, Kevin is in party and Kevin has LUK capstone:
			crit factor = crit factor/2 + 50%

		crit bonus:
			0 LUCK: 2
			10 LUCK: 23
			15 LUCK: 36
			20 LUCK: 51
			25 LUCK: 66
			28 LUCK: 75
			30 LUCK: 81
			33 LUCK: 90
		gear bonus:
			+15% Fencer's Armband
			+5% Dragon's Bone
			+20% Hawk's LUK capstone

	4.b) damage = damage * 125% if crit helm equipped


5) if Lv1 tech and damage > 1
	damage = damage * (tech factor + weapon bonus + counter bonus - tech guard) + tech bonus
		if muted treat AGL as 0
		tech factor:
			0 AGL: 110%
			10 AGL: 130%
			15 AGL: 140%
			20 AGL: 148%
			25 AGL: 156%
			28 AGL: 162%
			30 AGL: 166%
			33 AGL: 170%
		tech bonus:
			0 AGL: 0
			10 AGL: 16
			15 AGL: 22
			20 AGL: 30
			25 AGL: 40
			28 AGL: 46
			30 AGL: 50
			33 AGL: 56
		counter bonus:
			0 if not a counter attack
			otherwise
				value of weapon
				counter helm: +35%
				Hawk with AGL capstone is in party: +40%
				target is a physical resistant/immune monster: +25%
		tech guard:
			0 if no helm equipped
			Evade/4 otherwise


6) power up/down buff on attacker
	damage = damage * 1.25 for buff
	damage = damage * 0.75 for debuff
	no change if both or neither


7) defense up/down buff on target
	damage = damage * 0.75 for buff
	damage = damage * 1.25 for debuff
	no change if both or neither


8) element of saber matches element of day
	damage x1.125


9) difficulty factor
	varies by character and difficulty, compare to player/enemy strength in the README

10) damage degradation for targetting high level monster
	100% vs players
	100% vs enemies Lv1-10
	47.31% vs enemies Lv99


11) physical resistance/weakness
	x1.00 if performing a counter attack
	x1.00 if equipped with Levatein tier weapon
	x1.50 damage for weakness
	x0.50 damage for resistance
	x0.25 damage for strong resistance
	x0.00 damage for immunity


12) elemental resistance/weakness based on active saber
	x1.50 damage for weakness
	x0.50 damage for resistance
	x0.25 damage for immunity
	add a copy of the damage but as healing for absorption
	add a copy of the damage targetted at the attacker in case of reflection
		if reflected AND the original target had Platinum Armor: x1.75 damage
		otherwise do not change damage


13) damage = damage/2


14) if attack can inflict a status effect (before immunity check) and capstone Hawk/INT or Kevin/AGL is learned
	damage = damage + 40


15) if the attacker is a player and the attack was neither critical nor a Lv1 tech:
	if Ragnarok is equipped:
		damage = 1
	else
		damage x0.75


16) cap at 999 damage


17) if Lv1 tech and successful counter attack and Fireblaze equipped:
	reduce target physical defense permanently
		-25% for regular enemies
		-STR/2 for bosses
		-1 for bosses that are "immune" to this effect